package com.helsmanli.holiday.example;

import java.util.List;

import com.lmj.holiday.model.WeekDay;
import com.lmj.holiday.util.ChineseHolidaysUtil;

public class HolidayTest {
	
	public static void main(String[] args) throws Exception {
		String link = "http://www.gov.cn/zhengce/content/2020-11/25/content_5564127.htm";// 2021
        link = "http://www.gov.cn/zhengce/content/2021-10/25/content_5644835.htm";// 2022
        link = "http://www.gov.cn/zhengce/content/2019-11/21/content_5454164.htm";// 2020
        link = "http://www.gov.cn/zhengce/content/2018-12/06/content_5346276.htm"; // 2019
        link = "http://www.gov.cn/zhengce/content/2017-11/30/content_5243579.htm"; // 2018
		getLatestHolidayCalendarByLink(link).forEach(week -> System.out.println(week.toString()));
		// getLatestHolidayCalendarByLink(link);
		// getHolidayBySearchCount().forEach(week -> System.out.println(week.toString()));
		// getAllWeekDays(2022).forEach(week -> System.out.println(week.toString()));
	}
	
	// 获取2022年所有的日期【区分周六日】
	public static List<WeekDay> getAllWeekDays(int year){
		return ChineseHolidaysUtil.getWeekDays(year);
	}
	
	// 获取最新发布日期年的日历情况，包括周六日和节假日以及调休
	public static List<WeekDay> getLatestHolidayCalendar() throws Exception{
		return ChineseHolidaysUtil.getLatestHolidayCalendar();
	}
	
	// 根据网址获取最新发布日期年的日历情况，包括周六日和节假日以及调休
	public static List<WeekDay> getLatestHolidayCalendarByLink(String link) throws Exception{
		return ChineseHolidaysUtil.getLatestHolidayCalendarByLink(link);
	}
	
	// 获取最近count次所有节假日及调休日期
	public static List<WeekDay> getHolidayBySearchCount() throws Exception{
		return ChineseHolidaysUtil.getHolidayBySearchCount();
	}
	
}
